             package com.java.diagnostics.visualizer.recommender.memory;
             
             import com.java.diagnostics.visualizer.data.AggregateData;
             import com.java.diagnostics.visualizer.data.DataPoint;
             import com.java.diagnostics.visualizer.data.TupleData;
             import com.java.diagnostics.visualizer.gc.recommender.RecommendationPreferenceHelper;
             import com.java.diagnostics.visualizer.impl.axes.AxisUnits;
             import com.java.diagnostics.visualizer.recommender.Recommendation;
             import com.java.diagnostics.visualizer.recommender.RecommendationBase;
             import com.java.diagnostics.visualizer.recommender.util.RecommendationLabels;
             
             public class LookForLargeAllocations
               extends RecommendationBase
               implements Recommendation
             {
               public void recommend(AggregateData data)
               {
                 String gcMode = (String)getGCMode(data);
                 
                 TupleData largeObjectArea = data
                   .getTupleData("VGCLabels.free.loa.after.collection");
                 TupleData totalLargeObjectArea = data
                   .getTupleData("VGCLabels.total.loa.after");
                 TupleData flatHeapSize = data.getTupleData("VGCLabels.flat.heap.size");
                 
                 boolean iLMaxRec = false;
                 boolean iHRec = false;
                 boolean iLMinRec = false;
                 
                 if ((largeObjectArea == null) || (totalLargeObjectArea == null) || 
                   (flatHeapSize == null)) {
                   return;
                 }
                 DataPoint loa;
                 if ("gencon".equalsIgnoreCase(gcMode)) {
                   TupleData amountFailedTenured = data
                     .getTupleData("VGCLabels.amount.failed.tenured");
                   if (amountFailedTenured != null) {
                     DataPoint[] aFTDPs = amountFailedTenured.getDataPoints();
                     TupleData freeTenuredHeap = data
                       .getTupleData("VGCLabels.free.tenured.heap");
                     if (freeTenuredHeap == null) {
                       return;
                     }
                     
                     for (DataPoint amountFailedTenuredDP : aFTDPs)
                     {
                       if (amountFailedTenuredDP.getRawY() > this.helper.getRequestSizeThreshold()) {
                         loa = 
                           largeObjectArea.getDataPoint(amountFailedTenuredDP
                           .getSequenceUID());
                         DataPoint tloa = totalLargeObjectArea
                           .getDataPoint(amountFailedTenuredDP
                           .getSequenceUID());
                         DataPoint fHS = flatHeapSize
                           .getDataPoint(amountFailedTenuredDP
                           .getSequenceUID());
                         
                         double tloaHeapPercent = calculatePercentage(
                           tloa.getRawY(), fHS.getRawY());
                         
                         if ((loa.getY(AxisUnits.PERCENT_SIGN) < 30.0D) || 
                           (tloaHeapPercent < 1.0D))
                         {
                           if (tloaHeapPercent > 49.0D) {
                             iLMaxRec = true;
                             break;
                           }
                           
                           if (freeTenuredHeap.getMeanY(AxisUnits.PERCENT_SIGN) > 30.0D) {
                             iLMinRec = true;
                           } else if (!iHRec) {
                             iHRec = true;
                             suggestHeapSizes(data);
                           }
                         }
                       }
                     }
                   }
                 }
                 
                 if (("optavgpause".equalsIgnoreCase(gcMode)) || 
                   ("optthruput".equalsIgnoreCase(gcMode))) {
                   TupleData requests = data
                     .getTupleData("VGCLabels.request.sizes.which.triggered.failures");
                   DataPoint[] rDPs = requests.getDataPoints();
                   TupleData amountCompacted = data
                     .getTupleData("VGCLabels.amount.compacted");
                   TupleData freeHeap = data
                     .getTupleData("VGCLabels.free.flat.heap");
                   
                   for (DataPoint requestDataPoint : rDPs)
                   {
                     if ((requestDataPoint.getRawY() >= 65536.0D) && 
                       (amountCompacted != null) && 
                       (amountCompacted.getDataPoint(
                       requestDataPoint.getSequenceUID()) != null)) {
                        loa = largeObjectArea
                         .getDataPoint(requestDataPoint.getSequenceUID());
                       DataPoint tloa = totalLargeObjectArea
                         .getDataPoint(requestDataPoint.getSequenceUID());
                       DataPoint fHS = flatHeapSize.getDataPoint(
                         requestDataPoint.getSequenceUID());
                       
                       double tloaHeapPercent = calculatePercentage(
                         tloa.getRawY(), fHS.getRawY());
                       
                       if ((loa.getY(AxisUnits.PERCENT_SIGN) < 30.0D) || 
                         (tloaHeapPercent < 1.0D))
                       {
                         if (tloaHeapPercent > 49.0D) {
                           iLMaxRec = true;
                           break;
                         }
                         
                         if (freeHeap.getMeanY(AxisUnits.PERCENT_SIGN) > 30.0D) {
                           iLMinRec = true;
                         } else if (!iHRec) {
                           suggestHeapSizes(data);
                           iHRec = true;
                         }
                       }
                     }
                   }
                 }
                 
                 if (iLMaxRec) {
                   addWarning(data, RecommendationLabels.LARGE_OBJECTS + 
                     RecommendationLabels.MAX_LOA + 
                     RecommendationLabels.INCREASE_LOA_MAXIMUM);
                 } else if (iLMinRec) {
                   addWarning(data, RecommendationLabels.LARGE_OBJECTS + 
                     RecommendationLabels.INCREASE_LOA_MINIMUM);
                 } else if (iHRec) {
                   addWarning(data, RecommendationLabels.LARGE_OBJECTS + 
                     RecommendationLabels.INCREASE_HEAP);
                 }
               }
               
               private double calculatePercentage(double val1, double val2)
               {
                 return val1 / val2 * 100.0D;
               }
             }


